//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IVertex.h>
///	@path	~/src/graphics/
///	@date	2007/10/19
///	@desc	Vertex buffer.

#pragma once

#include "object/IObject.h"

#include "graphics/IDeviceResource.h"

// forward declaration
struct IUnknown;

namespace xeres {

	/*!
		\class	IVertex
		\brief	General interface of vertex buffer or index buffer.
	*/
	class IVertex : public IDeviceResource
	{
	public:

		/// \ctor
		IVertex( void );

		/// \dtor
		virtual ~IVertex( void );

		DECL_IOBJECT_INTERFACE( IVertex , IDeviceResource );

	public:

		/// \name Vertex Buffer Interface
		//@{

		/*!
			\brief		Get vertex count.
		*/
		virtual size_t GetCount( void ) = 0;

		/*! 
			\brief		Get vertex buffer size (in byte).
		*/
		virtual size_t GetSize( void ) = 0;

		/*! 
			\brief		Determine if vertex can be write by CPU.
		*/
		virtual bool IsWritable( void ) = 0;

		/*! 
			\brief		Determine if vertex can be read by CPU.
		*/
		virtual bool IsReadable( void ) = 0;

		/*! 
			\brief		Map vertex for write.
		*/
		virtual bool Map( bool discard , ResourceMap& data ) = 0;

		/*! 
			\brief		Map vertex for read back.
		*/
		virtual bool ReadBack( ResourceMap& data , bool readonly ) = 0;

		/*!
			\brief		Unmap vertex.
		*/
		virtual bool Unmap( void ) = 0;

		/*! 
			\brief		Get vertex interface.
		*/
		virtual IUnknown * GetVertexInterface( void ) = 0;

		/*! 
			\brief		Get index interface.
		*/
		virtual IUnknown * GetIndexInterface( void ) = 0;

		//@}
	};

} // namespace xeres
